#ifndef _main__h
#define __main_h
//HAL--------------------



//Const--------------------
//base 4ms
#define D_1s         250   //1s
#define D_40ms       10    //40ms
#define D_300ms   60 //300ms
#define D_500ms      125     //500ms
 #define D_1m        60

//Var----------------------
#ifdef  MAIN_C
uint8_t  timer40ms;
uint8_t timer1s;
uint8_t  timer500ms;
uint8_t longKeyHoldTime;
uint8_t longKeyValue;
uint8_t holdKey;
uint8_t longKeyJudgeTime;
uint8_t keyValue;
uint8_t startTime;
uint8_t setCurTemp;
bit bPowerOnOff;
//uint8_t flashSetClock;
uint8_t flashSetFunction;
uint8_t MorderClockOpenHour;
uint8_t MorderClockOpenMin;
uint8_t MorderClockCloseHour;
uint8_t MorderClockCloseMin;
uint8_t AorderClockOpenHour;
uint8_t AorderClockOpenMin;
uint8_t AorderClockCloseHour;
uint8_t AorderClockCloseMin;
uint8_t NorderClockOpenHour;
uint8_t NorderClockOpenMin;
uint8_t NorderClockCloseHour;
uint8_t NorderClockCloseMin;
uint8_t mainClockHour;
uint8_t mainClockMin;
bit bSecFlash500ms;
uint8_t gearFull;
bit bUpdateCurTemp;
//uint8_t flashsetClock;
uint8_t setClockNum;
uint8_t setFunctionNum;
uint8_t lastsetCurTemp;
uint8_t lastGear;
uint8_t function;
bit bLowTemp;
bit bSaveTemp;
bit bError;
bit bError1;
bit bError2;
bit bAdShort;
bit bAdOffBuzz;
uint8_t adShortNum;
bit bAdShortBuzz;
uint8_t adOffBuzzNum;
uint8_t adShortBuzzNum;
bit bHigTemp;
bit bOrderOpen;
bit bOrderClose;
//bit bPeople;
uint8_t lastP_rem;
uint8_t time1m;
bit bOpenBuzz;
uint8_t timer300ms;
bit bNoClock;
uint8_t timer1m;
bit bError3;
//bit bTG;
uint8_t mainClockMiao;
#else
extern uint8_t mainClockMiao;
extern bit bError3;
extern bit bNoClock;
extern uint8_t timer1m;
extern uint8_t timer300ms;
//extern bit bPeople;
//extern bit bTG;
extern bit bOpenBuzz;
extern uint8_t lastP_rem;
extern uint8_t time1m;
extern bit bOrderOpen;
extern bit bOrderClose;
extern uint8_t adOffBuzzNum;
extern uint8_t adShortBuzzNum;
extern bit bHigTemp;
extern bit bAdShortBuzz;
extern bit bError;
extern bit bError1;
extern bit bError2;
extern bit bAdShort;
extern bit bAdOffBuzz;
extern uint8_t adShortNum;
extern bit bSaveTemp;
extern bit bLowTemp;
extern uint8_t function;
//extern uint8_t flashsetClock;
extern  uint8_t lastGear;
extern uint8_t setClockNum;
extern uint8_t setFunctionNum;
extern bit bUpdateCurTemp;
extern uint8_t gearFull;
extern bit bSecFlash500ms;
extern  uint8_t mainClockHour;
extern uint8_t mainClockMin;
extern uint8_t MorderClockOpenHour;
extern uint8_t MorderClockOpenMin;
extern uint8_t MorderClockCloseHour;
extern uint8_t MorderClockCloseMin;
extern uint8_t AorderClockOpenHour;
extern uint8_t AorderClockOpenMin;
extern uint8_t AorderClockCloseHour;
extern uint8_t AorderClockCloseMin;
extern uint8_t NorderClockOpenHour;
extern uint8_t NorderClockOpenMin;
extern uint8_t NorderClockCloseHour;
extern uint8_t NorderClockCloseMin;
extern uint8_t setCurTemp;
extern bit bPowerOnOff;
//extern uint8_t flashSetClock;
extern uint8_t flashSetFunction;
extern uint8_t startTime;
extern uint8_t keyValue;
extern uint8_t  timer40ms;
extern uint8_t timer1s;
extern	uint8_t  timer500ms;
extern uint8_t longKeyHoldTime;
extern uint8_t longKeyValue;
extern uint8_t holdKey;
extern uint8_t longKeyJudgeTime;
#endif


//Function----------------------
void	remKey();
void OrderOpen();
void lowcurTemp();
void SetFunction();
void functionChoice();
//uint8_t  HourHandle(uint8_t number);
//uint8_t MinHandle(uint8_t number);
void timerControl();
void getKey();
void key1();
void key5();
void key3();
void key4();
void key6();
void PowerOff();
void PowerSet();
 void Error();
#endif